﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        function showResults(obj)
        {
            document.getElementById('results').src = 'json.rpc?jsonrpc=' + document.getElementById(obj).value;
        }
    </script>
</head>
<body>
    <p>The methods being invoked can be found in TestService.cs</p>
    <p>These examples use HTTP GET to make the JsonRpc request. I recommend <a target="_blank" href="http://www.fiddler2.com/fiddler2/">Fiddler2</a> to peek at http traffic. </p>
            <p>An example of a get request looks like:</p>
            <pre>
                  /json.rpc?jsonrpc={'method':'internal.echo','params':['Echo%20This'],'id':2}
            </pre>
    <div>
    <div style="float: left;">
        <div style="padding-left:50px;">Request: 
        </div> 
        <div>
            <input type="text" style="width: 600px;" id="ex1" value="{'method':'internal.echo','params':['Echo This'],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex1');">jsonrpc</button>
        </div>

        <div>
            <input type="text" style="width: 600px;" id="ex2" value="{'method':'myIp','params':[],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex2');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex3" value="{'method':'myUserAgent','params':[],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex3');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex4" value="{'method':'testDateTime','params':[],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex4');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex5" value="{'method':'testRecursiveClass','params':[],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex5');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex6" value="{'method':'testArbitraryJObject','params':[{'myparam':'myvalue','myOtherParam':7}],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex6');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex7" value="{'method':'testFloat','params':[7.625],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex7');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex8" value="{'method':'testInt','params':[7],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex8');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex9" value="{'method':'testCustomString','params':[{'str':'bye'}],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex9');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex10" value="{'method':'testMultipleParameters','params':['hi',1,1.2,{'str':'bye'}],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex10');">jsonrpc</button>
        </div>
        <div>

            <input type="text" style="width: 600px;" id="ex11" value="{'method':'error1','params':['This throws an exception'],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex11');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex12" value="{'method':'error2','params':['This throws a formatted exception'],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex12');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex13" value="{'method':'error3','params':['This throws a custom exception'],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex13');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex14" value="{'method':'error4','params':['This throws an exception using the JsonRpcContext'],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex14');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex15" value="{'method':'RequiresCredentials','params':['GoodPassword'],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex15');">jsonrpc</button>
        </div>
        <div>
            <input type="text" style="width: 600px;" id="ex16" value="{'method':'RequiresCredentials','params':['BadPassword'],'id':2}" />
            <button type="submit" onclick="javascript:showResults('ex16');">jsonrpc</button>
        </div>
    </div>
    <div>
        <div style="padding-left:50px;">Response:</div> 
        <iframe id="results"  style="float: right; width:50%;  height: 60%;"></iframe>
    </div>
        </div>
</body>
</html>
